<template>
  <div class="w-724px px-18px box-border flex flex-col items-center bg-white mt-10px rounded-8px">
    <Item v-for="item in userList" :data="item" v-if="userList.length > 0"></Item>
    <Empty title="暂无关注用户" v-else></Empty>
  </div>
</template>
<script setup>
import { ref, watchEffect } from 'vue'
import Empty from '@/components/empty/index.vue'
import { getFollowList, getFansList } from '@/api/user'
import Item from './user-item.vue'

const userList = ref([])
const props = defineProps(['type'])
watchEffect(() => {
  if (props.type === 'follow') {
    getFollowList({ page: 1, pageSize: 10 }).then((res) => {
      userList.value = res.list
    })
  }
  if (props.type === 'fans') {
    getFansList({ page: 1, pageSize: 10 }).then((res) => {
      userList.value = res.list
    })
  }
})
</script>
<style lang="less" scoped></style>
